package cn.com.utt.common.message;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;

public class DownloadResp extends Message {
	@JSONField(name = "sn")
	private String sn;
	@JSONField(name = "status")
	private int status;
	@JSONField(name = "error")
	private Fault Error;

	public DownloadResp() {
		setType(MessageType.DOWNLOADRESP.toString());
	}

	@Override
	public String encode() {
		return JSON.toJSONString(this);
	}

	@Override
	public void decode(byte[] buf) {
		DownloadResp resp = JSON.parseObject(buf, DownloadResp.class);
		this.setId(resp.getId());
		this.sn = resp.getSn();
		this.status = resp.getStatus();
		this.Error = resp.getError();
	}


	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Fault getError() {
		return Error;
	}

	public void setError(Fault error) {
		Error = error;
	}

}
